package com.lgx.right.util;

import org.apache.commons.lang.StringUtils;

import com.lgx.common.basic.dao.GeneralJdbcDao;


/**
 * 生成卡号
 * @author Administrator
 *
 */
public class CardUtils {
	
	public static final String BEGIN_CARD = "9";
	public static final int CARD_LEN = 12;
	public static final String DEFAULT_CARD = "900000000001";
	
	public static String createCard(String beginCard,GeneralJdbcDao dao)
	{
		String sql = "select max(id) from ts_card where id like '9%' order by id desc";
		String card = dao.getJdbcTemplate().queryForObject(sql, String.class);
		if(StringUtils.isEmpty(card))
		{
			card = DEFAULT_CARD;
		}else {
			long cLong = Long.parseLong(card);
			cLong ++ ;
			card = cLong+"";
		}
		return card;
	}
}
